/**
 * @Title:配置文件属性获取
 * @Package com.driver.utils.Configure 
 * @Description: key 获取 
 * @Copyright: Copyright (c) 2016 *  
 * @author ouywl
 * @date 2016年2月4日 下午22:49:54
 * @version V1.0 
 */
package cn.abcsys.cloud.devops.monitor.common;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

/*import org.slf4j.Logger; 
import org.slf4j.LoggerFactory;*/

public class ConfigureCommon {
	static Logger logger = Logger.getLogger(ConfigureCommon.class);
	private static Properties pps;

	// 构造函数
	public ConfigureCommon() {
		this.setPps(new Properties());
		InputStream in = this.getClass().getClassLoader()
				.getResourceAsStream("config/system.properties");
		try {
			getPps().load(in);
		} catch (IOException e) {
			logger.error("ConfigureCommon获取配置文件出错！");
			e.printStackTrace();
		}
	}

	// 构造函数
	public ConfigureCommon(String pathConf) {
		this.setPps(new Properties());
		InputStream in = this.getClass().getClassLoader()
				.getResourceAsStream(pathConf);
		try {
			getPps().load(in);
		} catch (IOException e) {
			logger.error("ConfigureCommon获取配置文件出错！");
			e.printStackTrace();
		}
	}

	// 获取key
	public String getKey(String key) {
		return getPps().getProperty(key);
	}

	public static Properties getPps() {
		return pps;
	}

	public void setPps(Properties pps) {
		ConfigureCommon.pps = pps;
	}

}
